package com.leaf.u_spring.chapter04;

import java.util.List;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;

import com.google.common.collect.Lists;
import com.leaf.u_spring.chapter02.CompactDisc;
import com.leaf.u_spring.chapter03.BlankDisc;


/**
 * 将BlankDisc和TrackCounter定义为bean，并启用AspectJ自动代理
 *
 */
@Configuration
@EnableAspectJAutoProxy
public class TrackCounterConfig {

	@Bean
	public CompactDisc sgtPeppers(){
		BlankDisc cd = new BlankDisc();
		cd.setTitle("阳光总在风雨后");
		cd.setArtist("许美静");
		
		List<String> tracks = Lists.newArrayList();
		tracks.add("阳光总在风雨后");
		tracks.add("成都");
		tracks.add("一生所爱");
		tracks.add("我的中国心");
		tracks.add("Alone Yet Not Alone");
		cd.setTracks(tracks);
		
		return cd;
	}
	
	@Bean
	public TrackCounter trackCounter(){
		return new TrackCounter();
	}
	
}
